﻿/*
 * This software is the confidential and proprietary
 * information of NetBay
 * Such confidential information should not be disclosed
 * NetBay copyright(c) 2010
 */

using System;
using System.ComponentModel;
using System.Runtime.Serialization;

namespace NetBay.Core.BusinessEntities
{
    /// <summary>
    /// Represents an ocr area. Implements INotifyPropertyChanged to enable databinding.
    /// </summary>
    [DataContract]
    public class OcrArea : ReturnObject, INotifyPropertyChanged
    {
        /// <summary>
        /// Occurs when a property value changes.
        /// </summary>
        public event PropertyChangedEventHandler PropertyChanged;

        [DataMember]
        public long Identifier { get; set; }

        [DataMember]
        public string Name
        {
            get
            {
                return this.m_sName;
            }

            set
            {
                if (value != this.m_sName)
                {
                    this.m_sName = value;
                    NotifyPropertyChanged("Name");
                }
            }
        } private string m_sName;

        [DataMember]
        public double X
        {
            get
            {
                return this.m_dX;
            }

            set
            {
                if (value != this.m_dX)
                {
                    this.m_dX = value;
                    NotifyPropertyChanged("X");
                }
            }
        } private double m_dX;

        [DataMember]
        public double Y
        {
            get
            {
                return this.m_dY;
            }

            set
            {
                if (value != this.m_dY)
                {
                    this.m_dY = value;
                    NotifyPropertyChanged("Y");
                }
            }
        } private double m_dY;

        [DataMember]
        public double Width
        {
            get
            {
                return this.m_dWidth;
            }

            set
            {
                if (value != this.m_dWidth)
                {
                    this.m_dWidth = value;
                    NotifyPropertyChanged("Width");
                }
            }
        } private double m_dWidth;

        [DataMember]
        public double Height
        {
            get
            {
                return this.m_dHeight;
            }

            set
            {
                if (value != this.m_dHeight)
                {
                    this.m_dHeight = value;
                    NotifyPropertyChanged("Height");
                }
            }
        } private double m_dHeight;

        /// <summary>
        /// Notifies the property changed.
        /// </summary>
        /// <param name="p_sPropertyName">Name of the property.</param>
        private void NotifyPropertyChanged(String p_sPropertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(p_sPropertyName));
            }
        }
    }
}
